package org.clockworkmages.games.anno1186.scripting.tools;

public class UtilScriptBuilder
		extends ScriptBuilder {

	public UtilScriptBuilder() {
		super(new StringBuffer("util"));
	}

	public UtilScriptBuilder(StringBuffer sb, BuilderWrapper parent) {
		super(sb, parent);
		sb.append("util");
	}

	public ScriptBuilder random(int range) {
		sb.append(".random(" + range + ")");
		return this;
	}

	public ScriptBuilder situationRandom(int range, String situationId) {
		sb.append(".situationRandom(" + range + ",'" + situationId + "')");
		return this;
	}

	public ScriptBuilder dailyRandom(int range, String dailyCacheKey) {
		sb.append(".dailyRandom(" + range + ",'" + dailyCacheKey + "')");
		return this;
	}

	public ScriptBuilder getHour() {
		sb.append(".getHour()");
		return this;
	}

	public ScriptBuilder isDay() {
		sb.append(".isDay()");
		return this;
	}

	public ScriptBuilder isNight() {
		sb.append(".isNight()");
		return this;
	}

	public ScriptBuilder chance(String pow) {
		sb.append(".chance(" + pow + ")");
		return this;
	}

	public ScriptBuilder roll(String pow) {
		sb.append(".roll(" + pow + ")");
		return this;
	}

	public ScriptBuilder roll(String pow, String cacheKey) {
		sb.append(".roll(" + pow + ",'" + cacheKey + "')");
		return this;
	}

	public ScriptBuilder fetishesEnabled(String... fetishIds) {
		String sFetishIds = "";
		for (String fetishId : fetishIds) {
			sFetishIds += ",'" + fetishId + "'";
		}
		sb.append(".fetishesEnabled(" + sFetishIds.substring(1) + ")");
		return this;
	}

	public ScriptBuilder goToLocation(String gameAreaId, int x, int y) {
		sb.append(".goToLocation('" + gameAreaId + "'," + x + "," + y + ")");
		return this;
	}
}
